﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

public partial class Users_PayReturn : System.Web.UI.Page
{
    HuatICBCPayService.ICBCService payService = new HuatICBCPayService.ICBCService();
    string orderId = string.Empty;
    string sOrderId = string.Empty;
    string emId = string.Empty;
    string emYear = string.Empty;
    string emNum = string.Empty;
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request.QueryString.Count > 0)
        {
            //一些验证信息
            string Oid = string.Empty;

            Oid = Request["OrderID"].ToString();
            Security security = new Security();
            if (Oid != null)
            {
                if (payService.Verify("cet.huat.edu.cn", "8260147"))
                {
                    DataTable dt = payService.GetOrderInfo(Oid);
                    if (dt.Rows.Count > 0)
                    {
                        if (dt.Rows[0]["transtat"].ToString() == "1")
                        {
                            string[] str = Oid.Split(new char[] { '-' });
                            orderId = str[1];
                            sOrderId = security.EncryptQueryString(orderId);
                            if (Exam.Order_Complete(orderId))
                            {
                                Response.Redirect("../BM/BM5.aspx?OrderID=" + sOrderId);
                            }


                        }
                        else
                        {
                            Response.Write("订单状态异常!请联系教务科!");
                        }
                    }
                }
            }
        }
    }
}